Dynomotion

Group: DynoMotion Message: 396 From: a_k@austarnet.com.au Date: 6/2/2010
Subject: Interupting a running thread
Hi Tom

I know I have asked this one before, but for the life of me I can't find the reply you sent to me.
How can I interupt an running c program????? I am using mach3, and if I press the "home all axis" button this runs my homing.c program. BUT if I press the estop button or have some sort of external alarm like a servo alarm, mach3 goes into an estop state but the kflop is still trying to run my homing code. So I need to some way to kill my homing program if it is running from my init.c program. At the moment I have to go into the kmotion console and send a "reboot" down to the kflop.

Regards
Andrew
Group: DynoMotion Message: 397 From: Tom Kerekes Date: 6/2/2010
Subject: Re: Interupting a running thread
Hi Andrew,
 
I think you need to check if the axis has been disabled in all your homing loops.
 
Something like:
 
 while (ReadBit(0) && ch0->Enable) ; // wait for home switch
 
or else while watching for the limit have the thread kill itself if the axis is disabled.  Like:
 
while (ReadBit(0) )
{
    if (!ch0->Enable) ThreadDone();
}
Regards
TK